<%@ page language="java"
    pageEncoding="UTF-8"%>
<%--核心库--%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>我的订单列表</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
		<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		<!-- 引入自定义css文件 style.css -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />

		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
			}
			
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>
	</head>

	<body>


		<div class="container">

			<%--导航页--%>
			<%@include file="/jsp/header.jsp"%>

			<div class="row">

				<div style="margin:0 auto; margin-top:10px;width:950px;">
					<strong>我的订单</strong>
					<table class="table table-bordered">

						<%--遍历所有订单--%>
						<c:forEach items="${pb.list}" var="o">
							<tbody>
							<tr class="success">
								<%--判断--%>
								<c:if test="${o.state==0}">
									<%--未支付--%>
									<th colspan="5">订单编号:${o.oid}
										<a href="${pageContext.request.contextPath}/order?methodName=getOrderById&oid=${o.oid}">查看订单详情</a>

								</c:if>
									<c:if test="${o.state==1}">
										<%--已支付付--%>
										<th colspan="5">订单编号:${o.oid}</th> <strong style="color: green;">已支付</strong>
									</c:if>

							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
								<%--展示订单项
									每一个订单实体里面--集合属性
								--%>
								<c:forEach items="${o.items}" var="oi">
									<tr class="active">
										<td width="60" width="40%">
											<input type="hidden" name="id" value="22">
											<img src="${pageContext.request.contextPath}/${oi.product.pimage}" width="70" height="60">
										</td>
										<td width="30%">
											<a target="_blank">${oi.product.pname}</a>
										</td>
										<td width="20%">
											￥${oi.product.shop_price}
										</td>
										<td width="10%">
											${oi.count}
										</td>
										<td width="15%">
											<span class="subtotal">￥${oi.subtotal}</span>
										</td>
									</tr>
								</c:forEach>

							</tbody>
						</c:forEach>

					<%--	<tbody>
							<tr class="success">
								<th colspan="5">订单编号:9004 </th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
							<tr class="active">
								<td width="60" width="40%">
									<input type="hidden" name="id" value="22">
									<img src="${pageContext.request.contextPath}/image/dadonggua.jpg" width="70" height="60">
								</td>
								<td width="30%">
									<a target="_blank"> 有机蔬菜      大冬瓜...</a>
								</td>
								<td width="20%">
									￥298.00
								</td>
								<td width="10%">
									5
								</td>
								<td width="15%">
									<span class="subtotal">￥596.00</span>
								</td>
							</tr>
						</tbody>
						<tbody>
							<tr class="success">
								<th colspan="5">订单编号:9003 </th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
							<tr class="active">
								<td width="60" width="40%">
									<input type="hidden" name="id" value="22">
									<img src="${pageContext.request.contextPath}/image/dadonggua.jpg" width="70" height="60">
								</td>
								<td width="30%">
									<a target="_blank"> 有机蔬菜      大冬瓜...</a>
								</td>
								<td width="20%">
									￥298.00
								</td>
								<td width="10%">
									5
								</td>
								<td width="15%">
									<span class="subtotal">￥596.00</span>
								</td>
							</tr>
						</tbody>
						<tbody>
							<tr class="success">
								<th colspan="5">订单编号:9002 </th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
							<tr class="active">
								<td width="60" width="40%">
									<input type="hidden" name="id" value="22">
									<img src="${pageContext.request.contextPath}/image/dadonggua.jpg" width="70" height="60">
								</td>
								<td width="30%">
									<a target="_blank"> 有机蔬菜      大冬瓜...</a>
								</td>
								<td width="20%">
									￥298.00
								</td>
								<td width="10%">
									5
								</td>
								<td width="15%">
									<span class="subtotal">￥596.00</span>
								</td>
							</tr>
						</tbody>--%>
					</table>
				</div>
			</div>
			<div style="text-align: center;">
				<ul class="pagination">
					<%--判断是第一页--%>
					<c:if test="${pb.currentPage==1}">
						<li class="disabled">
							<a href="javascript:void(0)" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
						</li>
					</c:if>
						<%--如果不是第一页--%>
					<c:if test="${pb.currentPage!=1}">
						<li>
							<a href="${pageContext.request.contextPath}/order?methodName=getOrderByPage&curPage=${pb.currentPage-1}&pSize=3" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
						</li>
					</c:if>

					<c:forEach begin="1" end="${pb.totalPage}" var="n">

						<%--判断是否是当前页--%>
						<c:if test="${pb.currentPage==n}">
							<li class="active">
								<a href="javascript:void(0)">${n}</a>
							</li>
						</c:if>
						<%--不是当前页--%>
						<c:if test="${pb.currentPage!=n}">
							<li>
								<a href="${pageContext.request.contextPath}/order?methodName=getOrderByPage&curPage=${n}&pSize=3">${n}</a>
							</li>
						</c:if>

					</c:forEach>

					<%--<li><a href="#">2</a></li>
					<li><a href="#">3</a></li>
					<li><a href="#">4</a></li>
					<li><a href="#">5</a></li>
					<li><a href="#">6</a></li>
					<li><a href="#">7</a></li>
					<li><a href="#">8</a></li>
					<li><a href="#">9</a></li>--%>
					<%--是最后一页--%>
					<c:if test="${pb.currentPage==pb.totalPage}">
						<li class="disabled">
							<a href="javascript:void(0)" aria-label="Next">
								<span aria-hidden="true">&raquo;</span>
							</a>
						</li>
					</c:if>
						<%--不是最后一页--%>
						<c:if test="${pb.currentPage!=pb.totalPage}">
							<li>
								<a href="${pageContext.request.contextPath}/order?methodName=getOrderByPage&curPage=${pb.currentPage+1}&pSize=3" aria-label="Next">
									<span aria-hidden="true">&raquo;</span>
								</a>
							</li>
						</c:if>

				</ul>
			</div>
		</div>

		<!--
                        描述：页脚部分
                    -->
			<div class="container-fluid">

				<div style="float: left;margin-left: 30px;margin-top: 25px">
					<img src="${pageContext.request.contextPath}/image/logo-mi2.png" width="80px" height="80px">
				</div>
				<div style="text-align: center;margin-top: 5px;float: left;margin-left: 30px;margin-top: 50px;text-align: center" >
					<ul class="list-inline">
						<li><a href="info.html">小米商城</a></li>|
						<li><a>MIUI</a></li>|
						<li><a>米家</a></li>|
						<li><a>多看</a></li>|
						<li><a>游戏</a></li>|
						<li><a>政企服务</a></li>|
						<li><a>小米天猫店</a></li>|
						<li><a>小米集团隐私政策</a></li>|
						<li><a>小米公司儿童信息保护规则</a></li>|
						<li><a>米家隐私</a></li>|
						<li><a>问题反馈</a></li>|
						<li><a>招贤纳士</a></li>|
						<li><a>投诉建议</a></li>
					</ul>
				</div>
				<div style="clear: both"></div>
				<div  style="text-align: center;margin-top: 5px;margin-bottom:20px;">

					Copyright &copy;2020-2030  Rice mall
				</div>
			</div>
	</body>

</html>